ProgressBar
| Kind of class: | class |
|---|---|
| Inherits from: | StatusIndicator < UIComponent < MovieClip |
| Classpath: | gfx.controls.ProgressBar |
| File last modified: | Tuesday, 29 June 2010, 09:03:27 |
The ProgressBar is similar to the StatusIndicator in that it also displays the status of an event or action using its timeline. However,it is also intended to be used in conjunction with a component or event that generates progress events. By assigning a target and setting its mode appropriately, the ProgressBar component will automatically change its visual state based on the loaded values (bytesLoaded and bytesTotal) of its target.
Inspectable Properties
A MovieClip that derives from the ProgressBar component will have the following inspectable properties:
There are no states for the ProgressBar component. The component’s frames are used to display the status of an event or action.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
Inspectable Properties
A MovieClip that derives from the ProgressBar component will have the following inspectable properties:
- visible: Hides the component if set to false.
- disabled: Disables the component if set to true.
- target: The target the ProgressBar will "listen" to, to determine the bytesLoaded and bytesTotal values.
- mode: Listening mode of the ProgressBar. In “manual” mode, the progress values must be set using the setProgress method. In "polled" mode, the target must expose bytesLoaded and bytesTotal properties, and in "event" mode, the target must dispatch "progress" events, containing bytesLoaded and bytesTotal properties.
- enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
- soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
There are no states for the ProgressBar component. The component’s frames are used to display the status of an event or action.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
- type: The event type.
- target: The target that generated the event.
- show: The component’s visible property has been set to true at runtime.
- hide: The component’s visible property has been set to false at runtime.
- progress: Generated when the ProgressBar value changes.
- complete: Generated when the ProgressBar value is equal to its maximum.
Component metadata:
| InspectableList | "disabled" "enableInitCallback" "inspectableTarget" "mode" "soundMap" "visible" |
|---|
Summary
Constructor
Instance properties
- soundMap
- Mapping between events and sound process
- target
- The target the ProgressBar will "listen" to to determine the bytesLoaded and bytesTotal.
- mode
- Determines how the ProgressBar "listens" for progress changes.
- percentLoaded
- The percent loaded, which is the value property, normalized to a number between 0 and 100.
Instance properties inherited from UIComponent
__height __width _disabled _displayFocus _focused addEventListener cleanUpEvents disabled dispatchEvent displayFocus enableInitCallback focused focusHandlerReference focusTarget hasEventListener height initialized invalidationIntervalID removeAllEventListeners removeEventListener sizeIsInvalid soundMap visible width
Class methods
Class methods inherited from UIComponent
Instance methods
- setProgress
- Set the progress of the component when it is in "manual" mode.
Instance methods inherited from StatusIndicator
Instance methods inherited from UIComponent
Constructor
ProgressBar
function ProgressBar (
)
The constructor is called when a ProgressBar or a sub-class of ProgressBar is instantiated on stage or by using
attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend ProgressBar, ensure that a super() call is made first in the constructor. Instance properties
mode
mode:String
(read,write)
Determines how the ProgressBar "listens" for progress changes.
Supported Modes:
Supported Modes:
- "manual": progress values are set using
setProgress() - "polled": The
bytestLoadedandbytesTotalproperties are checked on thetargetevery frame. - "event": The component listens for
progressandcompleteevents from thetarget
See also:
percentLoaded
percentLoaded:Number
(read)
The percent loaded, which is the
value property, normalized to a number between 0 and 100. soundMap
soundMap:Object = { theme:"default", progress:"progress", complete:"complete" }
(read,write)
Mapping between events and sound process
target
target:Object
(read,write)
The target the ProgressBar will "listen" to to determine the
bytesLoaded and bytesTotal. In "polled" mode, the target must expose bytesLoaded and bytesTotal properties, and in "event" mode, the target must dispatch "progress" events, containing bytesLoaded and bytesTotal properties. See also:
Instance methods
setProgress
function setProgress (
loaded:Number,
total:Number) : Void
Set the progress of the component when it is in "manual" mode.
Parameters:
loaded:
The amount loaded.
total :
The total loaded.
See also: